/**
 *@Title:ContactActivity.java
 *@Package:com.renmai.contact
 *@Description:TODO
 *@Author:Issac
 *@Date:2011-7-2下午04:51:24
 *@Version:v1.0
 */
package com.renmai.contact;


import com.renmai.R;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;

/**
 *@ClassName:ContactActivity
 *@Description:TODO
 *@Author:Issac
 *@Date:2011-7-2下午04:51:24
 */
public class ContactActivity extends Activity {
	
	private Button viewContact;
	static final int VIEW_CONTACT_LIST_REQUEST = 0;
	public static final int SAVE = Menu.FIRST;  
	public static final int BACK = Menu.FIRST + 1;  
	

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.contact);
		
		viewContact = (Button)findViewById(R.id.widget43);
		viewContact.setOnClickListener(new Button.OnClickListener(){
			@Override
			public void onClick(View arg0) {
				Intent intent = new Intent(ContactActivity.this, ViewContactListActivity.class);
				startActivity(intent);
				
				int version = Integer.valueOf(android.os.Build.VERSION.SDK);
				if(version  >= 5) {     
				     overridePendingTransition(R.layout.zoomin, R.layout.zoomout);  //此为自定义的动画效果，下面两个为系统的动画效果  
				     //overridePendingTransition(android.R.anim.fade_in,android.R.anim.fade_out);    
				     //overridePendingTransition(android.R.anim.slide_in_left,android.R.anim.slide_out_right);  
				}  
			}
		});
		
		
		
	}

	@Override
	protected void onDestroy() {
		super.onDestroy();
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		menu.add(0,SAVE,0,"新增");  
        menu.add(0,BACK,1,"返回");  
		return super.onCreateOptionsMenu(menu);
	}

	@Override
	public boolean onOptionsItemSelected(MenuItem item) {
		switch(item.getItemId()){  
        case SAVE: 
        	Intent intent = new Intent(ContactActivity.this, NewContactActivity.class);
			startActivity(intent);
			
			int version = Integer.valueOf(android.os.Build.VERSION.SDK);
			if(version  >= 5) {     
			     overridePendingTransition(R.layout.zoomin, R.layout.zoomout);  //此为自定义的动画效果，下面两个为系统的动画效果  
			     //overridePendingTransition(android.R.anim.fade_in,android.R.anim.fade_out);    
			     //overridePendingTransition(android.R.anim.slide_in_left,android.R.anim.slide_out_right);  
			}  
        	break;  
        case BACK:
        	Log.i("item", "back");
        	break;  
		}  
		return super.onOptionsItemSelected(item);
	}
	
	
	

}
